package prefixCount;

public class Solution {
    public int prefixCount(String[] words, String pref) {
        int ans = 0;
        for (String s: words) {
            if(check(s,pref)) {
                ans++;
            }
        }
        return ans;
    }
    private boolean check(String s,String pref) {
        if(s.length()<pref.length()) {
            return false;
        }
        for (int i = 0; i < pref.length(); i++) {
            if(s.charAt(i) != pref.charAt(i)) {
                return false;
            }
        }
        return true;
    }
}
